package tt.dz.appserver.dao.ext;

import java.util.List;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import tt.dz.appserver.dao.base.BasisDao;
import tt.dz.appserver.entity.model.pub.ShareComment;

/**
 * 分享评论dao
 * @author Administrator
 *
 */
@Repository
public class ShareCommentDao extends BasisDao<ShareComment>{

	
	/**
	 * 查询分享评论
	 * @param shareId
	 * @return
	 */
	@Cacheable(value="shareComment",key="#shareId")
	public List<ShareComment> findShareCommentByShareId(String shareId){
		
		ShareComment shareComment = new ShareComment();
		shareComment.setShare_id(shareId);
		shareComment.setValid_flag(1);
		return super.findExample(shareComment, null, null, "create_time", 0);
	}
	
	/**
	 * 新增分享评论
	 */
	@CacheEvict(value="shareComment",key="#shareComment.share_id")
	@Override
	public int save(ShareComment shareComment) {
		return super.save(shareComment);
	}
}
